package operator.condition;


import io.reactivex.Observable;
import io.reactivex.functions.Predicate;
import util.Printer;
import util.RxJavaHelper;
import util.ThreadHelper;

class SkipWhileOperator {

    public static void main(String[] args) {
        skipWhile();
    }

    /**
     * 知道表达式里面为false，下游开始接收，之后数据不再走验证流程
     */
    static void skipWhile(){
        Observable.just(1,2,3,4,5)
                .skipWhile(new Predicate<Integer>() {
                    @Override
                    public boolean test(Integer integer) throws Exception {
                        Printer.print("skipWhile test integer = " + integer);
                        return integer < 3;
                    }
                }).subscribe(RxJavaHelper.getConsumer());
        ThreadHelper.sleep();
    }


}
